/**
 * 
 */
package br.unifor.mia.cd.middleware.util;

import java.lang.reflect.Field;

import arcademis.Marshalable;
import br.unifor.mia.cd.middleware.encrypt.annotation.Encryptable;

/**
 * @author arthurlandim
 *
 */
public class ReflectionUtil {
	
	/**
	 * 
	 * @param clazz
	 * @return
	 */
	public static Encryptable getEncryptableAnnotationFromClass(Class<Marshalable> clazz) {
		Encryptable result = null;
		if (clazz.isAnnotationPresent(Encryptable.class)) {
			result = clazz.getAnnotation(Encryptable.class);
		}
		return result;
	}

	/**
	 * 
	 * @param obj
	 * @return
	 */
	public static Encryptable getEncryptableAnnotationFromField(Field field) {
		Encryptable result = null;
		if (field.isAnnotationPresent(Encryptable.class)) {
			result = field.getAnnotation(Encryptable.class);
		}
		return result;
	}

}
